home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
lib
/
mkmf
/
RCS
/
mkmf.library,v
< prev
next >
Wrap
Text File
|
1991-04-11
|
15KB
|
761 lines
head 1.21;
branch ;
access ;
symbols ;
locks ; strict;
comment @@;
1.21
date 91.04.11.12.53.32; author kupfer; state Exp;
branches ;
next 1.20;
1.20
date 89.10.09.21.28.18; author rab; state Exp;
branches ;
next 1.19;
1.19
date 89.08.18.11.21.41; author douglis; state Exp;
branches ;
next 1.18;
1.18
date 89.08.17.11.16.03; author douglis; state Exp;
branches ;
next 1.17;
1.17
date 89.04.06.21.40.30; author jhh; state Exp;
branches ;
next 1.16;
1.16
date 88.12.31.14.45.19; author ouster; state Exp;
branches ;
next 1.15;
1.15
date 88.11.27.16.28.38; author ouster; state Exp;
branches ;
next 1.14;
1.14
date 88.10.13.09.53.20; author ouster; state Exp;
branches ;
next 1.13;
1.13
date 88.08.15.09.30.08; author ouster; state Exp;
branches ;
next 1.12;
1.12
date 88.08.13.15.07.52; author ouster; state Exp;
branches ;
next 1.11;
1.11
date 88.08.12.14.38.28; author ouster; state Exp;
branches ;
next 1.10;
1.10
date 88.07.21.11.35.05; author douglis; state Exp;
branches ;
next 1.9;
1.9
date 88.07.20.10.22.26; author ouster; state Exp;
branches ;
next 1.8;
1.8
date 88.07.02.14.34.14; author ouster; state Exp;
branches ;
next 1.7;
1.7
date 88.06.27.09.56.50; author ouster; state Exp;
branches ;
next 1.6;
1.6
date 88.06.21.09.53.10; author ouster; state Exp;
branches ;
next 1.5;
1.5
date 88.06.17.16.28.11; author ouster; state Exp;
branches ;
next 1.4;
1.4
date 88.06.17.08.51.40; author ouster; state Exp;
branches ;
next 1.3;
1.3
date 88.04.04.22.57.45; author deboor; state Exp;
branches ;
next 1.2;
1.2
date 88.04.04.22.57.16; author deboor; state Exp;
branches ;
next 1.1;
1.1
date 88.03.18.15.10.15; author deboor; state Exp;
branches ;
next ;
desc
@Subscript for library source directories
@
1.21
log
@Flush DEFTARGET: the default target is now determined by a pmake
library file.
@
text
@#!/sprite/cmds/csh -f
#
# A script to generate (or regenerate) a library directory Makefile
# from a prototype Makefile. If ./Makefile.proto exists, use it, else
# use a common prototype. This script is invoked for libraries where
# the sources are all in a single directory, except for machine-dependent
# sources, which are in .md subdirectories
#
# We assume we were invoked from mkmf. Parameters passed in from mkmf
# through environment variables:
#
# DOMACHINES names of machines we are supposed to run mkmf on
# MKMFDIR directory containing prototype makefiles
# MKMFFLAGS arguments to all mkmfs run recursively
# MACHINES list of machine names (e.g. "sun2 sun3"), for
# which there are machine-dependent subdirectories
# (sun3.md, spur.md, etc.) of this directory.
# MAKEFILE name of makefile to create
# SUBTYPE additional keyword telling what sort of library
# this is: Sprite, X, etc.
#
#
# Argument processing. (Generalized form, even though just one flag so far.)
#
while ($#argv >= 1)
if ("$1" == '-x') then
set echo
endif
shift
end
set subtype=$SUBTYPE
set lib=$cwd:t
set pref='[a-z_A-Z]'
set machines=($MACHINES)
set domachines = ($DOMACHINES)
set makefile=$MAKEFILE
set distdir=($DISTDIR)
if (-e $makefile.proto) then
set proto=$makefile.proto
else
set proto="${MKMFDIR}/Makefile.library"
endif
echo "Generating a Makefile for library $lib using $proto"
set nonomatch
set hdrs =( ${lib}*.h )
if ("$hdrs" == "${lib}*.h") set hdrs=()
set pubHdrs=(`echo $hdrs | sed -e "s/[^ ]*Int.h//g"`)
set allSrcs =( ${pref}*.[cylsp] )
#
# Check to see if there were any sources. The first check (size == 1)
# is only necessary because the second check will cause an error if
# allSrcs contains more than 1024 bytes.
#
if ($#allSrcs == 1) then
if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
endif
set mdsrcs =( *.md/${pref}*.[cylsp] )
if ($#mdsrcs == 1) then
if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
endif
set allSrcs=($allSrcs $mdsrcs)
set lints = ( *.lint )
if ("$lints" == "*.lint") set lints=()
set manPages = (*.man)
if ("$manPages" == "*.man") set manPages=()
#
# Use sed to substitute various interesting things into the prototype
# makefile. The code below is a bit tricky because some of the variables
# being substituted in can be very long: if the substitution is passed
# to sed with "-e", the entire variable must fit in a single shell argument,
# with a limit of 1024 characters. By generating a separate script file
# for the very long variables, the variables get passed through (to the
# script file) as many arguments, which gets around the length problem.
#
rm -f mkmf.tmp.sed
echo s,"@@(ALLSRCS)",$allSrcs,g > mkmf.tmp.sed
echo s,"@@(MANPAGES)",$manPages,g > mkmf.tmp.sed2
cat $proto | sed -f mkmf.tmp.sed -f mkmf.tmp.sed2 \
-e "s,@@(DATE),`date`,g" \
-e "s,@@(LINTSRCS),$lints,g" \
-e "s,@@(MACHINES),$machines,g" \
-e "s,@@(NAME),$lib,g" \
-e "s,@@(MAKEFILE),$makefile,g" \
-e "s,@@(PUBHDRS),$pubHdrs,g" \
-e "s,@@(TEMPLATE),$proto,g" \
-e "s,@@(TYPE),$subtype,g" \
-e "s,@@(DISTDIR),$distdir,g" \
> $makefile
rm -f mkmf.tmp.sed mkmf.tmp.sed2
setenv PARENTDIR $cwd
foreach i ($domachines)
(cd $i.md; mkmf $MKMFFLAGS -f md.mk)
end
@
1.20
log
@Modifications for distribution.
@
text
@a11 1
# DEFTARGET name of default target
a38 1
set defTarget=($DEFTARGET)
a86 1
-e "s,@@(DEFTARGET),${defTarget:q},g" \
@
1.19
log
@another change for TM -- use single machine if it exists, else \ds3100
@
text
@d41 1
d97 1
@
1.18
log
@removed DEFTARGET -- we use $MACHINE now
@
text
@d12 1
d40 1
d88 1
@
1.17
log
@added abilty to make specific machine types
@
text
@a11 1
# DEFTARGET name of default target
a38 1
set defTarget=($DEFTARGET)
a85 1
-e "s,@@(DEFTARGET),$defTarget,g" \
@
1.16
log
@Use TYPE instead of INSTALLDIR, INSTALLMAN, etc.
@
text
@d12 2
d38 1
d40 1
a49 6
if (" $machines " =~ *\ sun3\ *) then
set defTarget=sun3
else
set defTarget=$machines[1]
endif
d99 2
a100 1
foreach i ($machines)
@
1.15
log
@Various changes to replace old C library entirely with new C library.
@
text
@a33 25
switch ($subtype)
case sprite:
set includedir=/sprite/lib/include
set installdir=/sprite/lib
set installman=/sprite/doc/ref/lib/$lib
set lintdir=/sprite/lib/lint
breaksw
case x:
set includedir=/X/lib/include
set installdir=/X/lib
set installman=/X/doc/ref/lib/$lib
set lintdir=/X/lib/lint
breaksw
case none:
# These are dummy assignments for libraries used locally by programs
# but never installed.
set includedir = none
set installdir = none
set installman = none
set lintdir = none
breaksw
default:
echo Unknown library subtype "$subtype"
exit 1
endsw
a90 4
-e "s,@@(INCLUDEDIR),$includedir,g" \
-e "s,@@(INSTALLDIR),$installdir,g" \
-e "s,@@(INSTALLMAN),$installman,g" \
-e "s,@@(LINTDIR),$lintdir,g" \
d97 1
@
1.14
log
@Allow "none" type, meaning it doesn't get installed.
@
text
@d22 10
d33 1
d36 1
d38 1
a39 1
set includedir=/sprite/lib/include.new
d42 4
a45 3
set installdir=/sprite/lib
set lintdir=/sprite/lib/lint
set includedir=/a/X/lib/include
d50 1
d52 1
a53 1
set includedir = none
a58 1
set lib=$cwd:t
d97 2
d112 3
a114 3
cat $proto | sed -f mkmf.tmp.sed \
-e "s,@@(LIBRARY),$lib,g" \
-e "s,@@(MACHINES),$machines,g" \
d118 1
a118 1
-e "s,@@(PUBHDRS),$pubHdrs,g" \
d121 2
d124 1
a125 1
-e "s,@@(DATE),`date`,g" \
d127 1
a127 1
rm -f mkmf.tmp.sed
@
1.13
log
@Eliminate symbolic link: goofs up renames.
@
text
@d34 7
@
1.12
log
@Set up for X stuff.
@
text
@d32 1
a32 1
set includedir=/X/lib/include
@
1.11
log
@No need to look for MAKEFILE or MACHINES. Also, be more restrictive
on which headers are exported.
@
text
@d18 2
a20 18
# Variables generated here:
# includedir place where public header files get installed
# lib base library name to create (directories are assumed
# to be named after the libraries they create): sx, tcl,
# m, etc.
# lints list of ".lint" files; these are dummy .c files
# that supply lint information for assembler procedures
# that lint cannot process.
# machines list of machines for which we can target: needed
# because env variables can't always be used where
# variables can.
# makefile name of the makefile to create
# pref prefix pattern that files must match to be included
# proto name of prototype makefile to use to create $makefile
# pubHdrs list of header files that this directory exports to
# the rest of the world.
# subtype subtype of makefile to make (e.g. att, src, local, etc.)
#
d28 5
@
1.10
log
@added ability to turn on echoing for all mkmf's invoked.
@
text
@d35 1
a35 1
# type type of makefile to make (e.g. att, src, local, etc.)
d38 2
a39 2
set type=$TYPE
switch ($type)
d46 1
a46 1
echo Unknown library type "$type"
a50 5
if ($?MACHINES == 0) then
echo "No target machines for $lib"
exit 1
endif
d52 1
a52 4
if ("$machines" == "") then
echo "No target machines for $lib"
exit 1
endif
a53 6
if ($?MAKEFILE) then
set makefile=$MAKEFILE
else
set makefile=Makefile
endif
d69 2
a70 2
set hdrs =( ${pref}*.h )
if ("$hdrs" == "${pref}*.h") set hdrs=()
a118 2
pmake dependall
@
1.9
log
@Add code to be more careful about long lists of source files.
@
text
@d13 1
d131 1
a131 1
(cd $i.md; mkmf -f md.mk)
@
1.8
log
@Better support for lint, and for dummy lint files (*.lint).
@
text
@d86 8
a93 1
if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
d95 3
a97 1
if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
@
1.7
log
@Add "type" field to map, pass it through to individual mkmf.*
scripts so they don't have to do their own path-name analysis.
@
text
@d19 1
a19 1
# type type of makefile to make (e.g. att, src, local, etc.)
d22 4
a25 4
# m, etc.
# pref prefix pattern that files must match to be included
# makefile name of the makefile to create
# proto name of prototype makefile to use to create $makefile
d29 6
d90 2
d113 1
@
1.6
log
@(temporarily) install in new include area.
@
text
@d30 2
a31 1
set type=`expr $cwd : '/[^/]*/\([^/]*\)/.*'`
d33 1
a33 1
case src:
a37 10
case att:
set installdir=/att/lib
set lintdir=/att/lib/lint
set includedir=/att/lib/include
breaksw
case local:
set installdir=/local/lib
set lintdir=/local/lib/lint
set includedir=/local/lib/include
breaksw
d39 2
a40 5
set installdir=`echo $cwd | sed -e s,/src,,`
set installdir=$installdir:h
set lintdir=$installdir/lint
set includedir=$installdir/include
breaksw
@
1.5
log
@Changes to handle directories with many many files.
@
text
@d35 1
a35 1
set includedir=/sprite/lib/include
@
1.4
log
@Add stuff for target machines.
@
text
@d97 13
a109 1
cat $proto | sed \
a112 1
-e "s,@@(ALLSRCS), $allSrcs,g" \
d121 1
@
1.3
log
@Forgot to redirect to $makefile rather than Makefile
@
text
@d4 4
a7 2
# from the prototype Makefile. If ./Makefile.proto exists, use it, else
# use a common prototype.
d9 2
a10 3
# We assume we were invoked from mkmf, thus we don't need to alter the
# path, and MKMFDIR is in the environment to tell us where to find prototype
# makefiles, etc.
d12 7
a18 1
# Variables:
d21 2
a22 1
# to be named after the libraries they create)
d25 4
a28 1
# MKMFDIR directory containing prototype makefiles
d38 3
a40 3
set installdir=/sprite/att/lib
set lintdir=/sprite/att/lib/lint
set includedir=/sprite/att/lib/include
d43 3
a45 3
set installdir=/sprite/local/lib
set lintdir=/sprite/local/lib/lint
set includedir=/sprite/local/lib/include
d57 10
d81 4
a84 28
#
# First figure out what's there by way of .c, .y, .l, .s, .p, .h and .o files
# If any one doesn't have any members, it'll contain the original
# pattern (b/c of nonomatch). We want it to be empty, though, so
# we reset it.
#
set nonomatch
set srcs=( ${pref}*.[cylsp] )
if ("$srcs" == "${pref}*.[cylsp]") set srcs=()
set Hfiles=( ${pref}*.h )
if ("$Hfiles" == "${pref}*.h") set Hfiles=()
rm -f version.o
set Ofiles=( ${pref}*.o )
if ("$Ofiles" == "${pref}*.o") set Ofiles=()
unset nonomatch
#
# Merge in any .o files that can be created from local source files but don't
# exist yet. In addition, figure out which .o files may be safely removed
# during a "make clean" and store them in RmOfiles.
#
set RmOfiles=""
if ("$srcs" != "") then
foreach file ($srcs)
set file=$file:r.o
set RmOfiles=($RmOfiles $file)
if (! -e $file) set Ofiles=($Ofiles $file)
end
d87 9
a95 1
set PubHfiles=(`echo $Hfiles | sed -e "s/${pref}*Int\.h//g"`)
a96 2
if (-e $makefile) mv $makefile $makefile.$$~
d99 4
a102 5
-e "s,@@(OBJS),$Ofiles,g" \
-e "s,@@(CLEANOBJS),$RmOfiles,g" \
-e "s,@@(SRCS),$srcs,g" \
-e "s,@@(HDRS),$Hfiles,g" \
-e "s,@@(PUBHDRS),$PubHfiles,g" \
d104 1
d106 1
a106 1
-e "s,@@(INCLUDEDIR),$includedir,g" \
a108 1
-e "s,@@(MAKEFILE),$makefile,g" \
d110 6
@
1.2
log
@Switched to MKMFNF
@
text
@d107 1
a107 1
> Makefile
@
1.1
log
@Initial revision
@
text
@d3 3
a5 2
# A script to generate (or regenerate) a module Makefile
# from the prototype Makefile.
d7 41
a47 7
set module=`pwd`
set root = $module:h; set root = $root:h; set root = $root:h
set module=$module:t
if ($root != /sprite) then
set otherh = '${ROOT}/lib/include'
set otherlint = '${ROOT}/lib/lint'
d49 1
a49 2
set otherh = ""
set otherlint = ""
d52 5
a56 1
echo "Generating a Makefile for library: $module within $root."
d58 8
a65 1
unalias ls
d67 8
a74 4
set Cfiles=`ls [a-z_]*.c`
set Hfiles=`ls [a-z_]*.h`
set Sfiles=`ls [a-z_]*.s`
set Stubfiles=`ls [a-z_]*Stubs.s`
d76 12
a87 7
set Ofiles=`echo $Cfiles $Sfiles | sed -e "s/\.c/.o/g" -e "s/\.s/.o/g"`
set POfiles=`echo $Cfiles $Sfiles | sed -e "s/\.c/.po/g" -e "s/\.s/.o/g"`
set ExternalHfiles=`echo $Hfiles | sed -e "s/[a-zA-Z]*Int\.h//g"`
if ("$ExternalHfiles" == "") then
set extString = "# EXTERNHDRS ="
else
set extString = "EXTERNHDRS = $ExternalHfiles"
d90 1
a90 1
if (-e Makefile) mv Makefile Makefile.$$~
d92 1
a92 5
if (-e Makefile.proto) then
set proto=Makefile.proto
else
set proto=/sprite/src/lib/makemake/Makefile.library
endif
d94 13
a106 13
cat $proto | \
sed -e "s@@^LIBROOT.*@@LIBROOT = $root@@" \
-e "s@@^MODULE.*@@MODULE = $module@@" \
-e "s@@^OTHERH.*@@OTHERH = $otherh@@" \
-e "s@@^OTHERLINT.*@@OTHERLINT = $otherlint@@" \
-e "s@@^CSRCS.*@@CSRCS = $Cfiles@@" \
-e "s@@^ASMSRCS.*@@ASMSRCS = $Sfiles@@" \
-e "s@@^STUBS.*@@STUBS = $Stubfiles@@" \
-e "s@@^HDRS.*@@HDRS = $Hfiles@@" \
-e "s@@^EXTERNHDRS.*@@$extString@@" \
-e "s@@^OBJS.*@@OBJS = $Ofiles@@" \
-e "s@@^POBJS.*@@POBJS = $POfiles@@" \
-e "s@@..LINT./$module\.ln@@@@" \
a107 14
if (-e Makefile.sed) then
echo "Modifying with Makefile.sed."
mv Makefile{,.$$~~}
sed -f Makefile.sed Makefile.$$~~ > Makefile
rm Makefile.$$~~
endif
if (-e Makefile.ex) then
echo "Modifying with Makefile.ex."
ex - Makefile < Makefile.ex
endif
make depend
@